<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
var arr=[1,2,3,4,2,5,6,2,7,2];
     console.log('原数组为：'+arr);
     var index=0,newarr=[];
     for(var i in arr){
    	 if(arr[i]!==2){
    		 newarr[index]=arr[i];
    		 ++index;
    	 }
    	 console.log('新数组为：'+newarr);
    	 
     }
     
     

</script>

</body>
</html>